﻿#region License
/* Copyright (C) 2009 Tim Coulter
 * 
 * This file is part of ExtremeML.
 * 
 * ExtremeML is free software: you can redistribute
 * it and/or modify it under the terms of the GNU General Public
 * License, as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 * 
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty
 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
 * the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see http://www.gnu.org/licenses/.
*/
#endregion

using System;

namespace ExtremeML.Core
{
	/// <summary>
	/// The exception that is thrown when semantic errors are discovered in the template package.
	/// </summary>
	public class PackageException : Exception
	{
		/// <summary>
		/// Initializes a new instance of the <see cref="PackageException"/> class.
		/// </summary>
		/// <param name="message">A message that describes the error.</param>
		public PackageException(
			string message)
			: base(message)
		{
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="PackageException"/> class.
		/// </summary>
		/// <param name="message">A message that describes the error.</param>
		/// <param name="args">An array containing zero or more objects to format into the message string.</param>
		public PackageException(
			string message,
			params object[] args)
			: base(Utility.SafeFormat(message, args))
		{
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="PackageException"/> class.
		/// </summary>
		/// <param name="message">A message that describes the error.</param>
		/// <param name="inner">The exception that is the cause of the current exception.</param>
		public PackageException(
			string message,
			Exception inner)
			: base(message, inner)
		{
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="PackageException"/> class.
		/// </summary>
		/// <param name="message">A message that describes the error.</param>
		/// <param name="inner">The exception that is the cause of the current exception.</param>
		/// <param name="args">An array containing zero or more objects to format into the message string.</param>
		public PackageException(
			string message,
			Exception inner,
			params object[] args)
			: base(Utility.SafeFormat(message, args), inner)
		{
		}
	}
}
